using Catchbase.Service.API;
using Catchbase.TestTools.UTest;
using Microsoft.Practices.Unity;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Catchbase.Service.ATest
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable"), TestClass]
    public abstract class ServiceTest<T> where T : class
    {
        protected ServiceClient<T> Service;
        private UnityContainer _container;
        protected SecretSettings Settings;

        [TestInitialize]
        public void InitializeTest()
        {
            _container = new UnityContainer();
            new ContainerConfiguration().Configure(_container);
            SecurityManager = _container.Resolve<ISecurityManager>();
            Service = _container.Resolve<ServiceClient<T>>();
            Settings = _container.Resolve<SecretSettings>();
        }

        [TestCleanup]
        public void CleanupTest()
        {
            _container.Dispose();
        }

        protected ISecurityManager SecurityManager { get; private set; }
    }
}